from flask import Flask,request,render_template
import json
import sql


sqlBaee = sql.Sql("root","123456","game","127.0.0.1","33306")


app = Flask(__name__)
 
 
@app.route('/')
def index():
    return 'hello world'
 
 
@app.route('/json')
def returnjson():
    s=['张三','年龄','姓名']
    t={}
    t['data']=s
    return json.dumps(t,ensure_ascii=False)

@app.route('/getfromdb')
def getfromdb():
    # 处理数据库逻辑
    return "返回数据库信息"

@app.route('/case/list')
def getallcase():
    data = sqlBaee.get_all_success_case()
    t = {}
    t['data'] = data
    return json.dumps(t,ensure_ascii=False)
if __name__ == '__main__':
    app.run(debug=True)

# 运行程序的方式
# 安装python3

# pip3 install install falsk 


# 后续只需要 python3 main.py 即可运行

# 游览器输入 http://127.0.0.1:5000/json 显示数据